package net.cyndeline.entitySystem.event

import net.cyndeline.entitySystem.Component
import net.cyndeline.entitySystem.Event
import net.cyndeline.events.ModifyError

class RemovedComponent extends RemovedComponentEvent with ModifyError {
  private var comp: Option[Component] = None
  
  override def component: Option[Component] = comp
  override def component_=(c: Option[Component]) {
    modify("component", this)
    comp = c
  }
  
  override def copy = {
    val copy = new RemovedComponent()
    copy.component = comp match {
      case Some(component) => Option(component.copy)
      case None => None
    }
    copy
  }
}

trait RemovedComponentEvent extends Event {
  def component: Option[Component]
  def component_=(comp: Option[Component])
}